package tk.djcrazy.instantmessage.serviceImpl;

import tk.djcrazy.instantmessage.domain.LoginState;
import tk.djcrazy.instantmessage.eventhandler.UserLoginStateHandler;
import tk.djcrazy.instantmessage.service.IUserStateService;

public class UserStateServiceImpl implements IUserStateService {
	private final UserLoginStateHandler handler = new UserLoginStateHandler();
	
	@Override
	public void updateActiveTime(int id) {
		handler.updateOnlineState(id);
	}

	@Override
	public void setOffline(int id) {
		handler.changeUserLoginState(id, LoginState.OFF_LINE);
	}

	@Override
	public LoginState getState(int id) {
		return handler.getState(id);
	}

	@Override
	public void changeLoginState(int id, LoginState state) {
		handler.changeUserLoginState(id, state);
	}
}
